//zed

print("*** start\n")

function logMyErrors(e)
   print("OK - thrown exception caught")
   print("e is : " + e)
end

function UserException(message)
   this.message = message;
   this.name = "UserException";
end

function getMonthName(mo)
   mo = mo-1; // Adjust month number for array index (1=Jan, 12=Dec)
   var months = new Array("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",
      "Aug", "Sep", "Oct", "Nov", "Dec");
   if (months[mo] != null)
      return months[mo];
   else
      throw "InvalidMonthNo";
   end
end

try
   // statements to try
   var myMonth = "ZZZ"
   monthName = getMonthName(myMonth);
catch (e)
   logMyErrors(e); // pass exception object to err handler
end

print("\n*** end ");
